<?php
require_once 'Zend/Auth.php';
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {

$user=$auth->getIdentity()->id;
}else
{
    header("Location: /adm/login.php");
    
}
require('../class/sql.php');
require('../class/sitemap.php');
require('../class/setup.php');
    //print_r($_POST);
if(isset($_POST['id'])&&($_POST['id'] == 'new')&&(!empty($_POST['title'])))
{
    $data = array('title'=>$_POST['title']);
    $addpost = $db->insert('order_ap_name',$data);
}elseif(isset($_POST['id'])&&(!empty($_POST['title'])))
{
    $data = array('title'=>$_POST['title']);
    $where = $db->quoteInto("id = ?",$_POST['id']);                                    
    $addpost = $db->update('order_ap_name',$data,$where);
}
$url = "http://".$_SERVER['HTTP_HOST']."/adm/custom.php";
header("Location: $url");
?>